HAL LPTIM types migration ¶
This section provides information about the HAL LPTIM types migration.
HAL LPTIM active channel type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_LPTIM_ACTIVE_CHANNEL_1 ,
HAL_LPTIM_ACTIVE_CHANNEL_2 ,
HAL_LPTIM_ACTIVE_CHANNEL_CLEARED ,
} HAL_LPTIM_ActiveChannel;
|
Removed Note In HAL1, the enumeration is used to determine the active channel within the callback by reading the field channel of the LPTIM_TypeDef handle.
In HAL2, the enumeration is removed and the active channel is now an argument of type
|
HAL LPTIM callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_LPTIM_MSPINIT_CB_ID ,
HAL_LPTIM_MSPDEINIT_CB_ID ,
HAL_LPTIM_COMPARE_MATCH_CB_ID ,
HAL_LPTIM_AUTORELOAD_MATCH_CB_ID ,
HAL_LPTIM_TRIGGER_CB_ID ,
HAL_LPTIM_COMPARE_WRITE_CB_ID ,
HAL_LPTIM_AUTORELOAD_WRITE_CB_ID ,
HAL_LPTIM_DIRECTION_UP_CB_ID ,
HAL_LPTIM_DIRECTION_DOWN_CB_ID ,
HAL_LPTIM_UPDATE_EVENT_CB_ID ,
HAL_LPTIM_REP_COUNTER_WRITE_CB_ID ,
HAL_LPTIM_UPDATE_EVENT_HALF_CB_ID ,
HAL_LPTIM_ERROR_CB_ID ,
HAL_LPTIM_IC_CAPTURE_CB_ID ,
HAL_LPTIM_IC_CAPTURE_HALF_CB_ID ,
HAL_LPTIM_OVER_CAPTURE_CB_ID ,
} HAL_LPTIM_CallbackIDTypeDef;
|
|
HAL LPTIM state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_LPTIM_STATE_RESET
HAL_LPTIM_STATE_READY
HAL_LPTIM_STATE_BUSY
HAL_LPTIM_STATE_TIMEOUT
HAL_LPTIM_STATE_ERROR
} HAL_LPTIM_StateTypeDef;
|
typedef enum
{
HAL_LPTIM_STATE_RESET
HAL_LPTIM_STATE_IDLE
HAL_LPTIM_STATE_ACTIVE
HAL_LPTIM_STATE_INIT
HAL_LPTIM_STATE_ACTIVE_SILENT
} hal_lptim_state_t;
Note
|
HAL LPTIM channel state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_LPTIM_CHANNEL_STATE_RESET
HAL_LPTIM_CHANNEL_STATE_READY
HAL_LPTIM_CHANNEL_STATE_BUSY
} HAL_LPTIM_ChannelStateTypeDef;
|
typedef enum
{
HAL_LPTIM_CHANNEL_STATE_RESET,
HAL_LPTIM_OC_CHANNEL_STATE_IDLE,
HAL_LPTIM_IC_CHANNEL_STATE_IDLE,
HAL_LPTIM_OC_CHANNEL_STATE_ACTIVE,
HAL_LPTIM_IC_CHANNEL_STATE_ACTIVE,
HAL_LPTIM_OC_CHANNEL_STATE_ACTIVE_SILENT
HAL_LPTIM_IC_CHANNEL_STATE_ACTIVE_SILENT
} hal_lptim_channel_state_t;
Note
|
HAL LPTIM clock configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Source;
uint32_t Prescaler;
} LPTIM_ClockConfigTypeDef;
|
hal_lptim_clk_src_t source;
hal_lptim_clk_src_presc_t prescaler;
typedef enum
{
HAL_LPTIM_CLK_INTERNAL ,
HAL_LPTIM_CLK_EXTERNAL_SYNCHRONOUS ,
HAL_LPTIM_CLK_EXTERNAL_ASYNCHRONOUS ,
HAL_LPTIM_CLK_ENCODER_SUBMODE_1 ,
HAL_LPTIM_CLK_ENCODER_SUBMODE_2 ,
HAL_LPTIM_CLK_ENCODER_SUBMODE_3 ,
} hal_lptim_clk_src_t;
typedef enum
{
HAL_LPTIM_CLK_SRC_DIV1 ,
HAL_LPTIM_CLK_SRC_DIV2 ,
HAL_LPTIM_CLK_SRC_DIV4 ,
HAL_LPTIM_CLK_SRC_DIV8 ,
HAL_LPTIM_CLK_SRC_DIV16 ,
HAL_LPTIM_CLK_SRC_DIV32 ,
HAL_LPTIM_CLK_SRC_DIV64 ,
HAL_LPTIM_CLK_SRC_DIV128 ,
} hal_lptim_clk_src_presc_t;
|
HAL LPTIM handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
LPTIM_HandleTypeDef; |
hal_lptim_handle_t |
HAL LPTIM input capture configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t ICInputSource;
uint32_t ICPrescaler;
uint32_t ICPolarity;
uint32_t ICFilter;
} LPTIM_IC_ConfigTypeDef;
|
typedef struct
{
hal_lptim_ic_src_t source;
hal_lptim_ic_prescaler_t prescaler;
hal_lptim_ic_polarity_t polarity;
hal_lptim_filter_t filter;
} hal_lptim_ic_config_t;
|
HAL LPTIM initialization type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
LPTIM_ClockConfigTypeDef Clock;
uint32_t Period;
uint32_t RepetitionCounter;
LPTIM_TriggerConfigTypeDef Trigger;
uint32_t Input1Source;
uint32_t Input2Source;
LPTIM_ULPClockConfigTypeDef UltraLowPowerClock;
uint32_t UpdateMode;
uint32_t CounterSource;
} LPTIM_InitTypeDef;
|
typedef struct
{
hal_lptim_clk_src_t clock_source;
hal_lptim_clk_src_presc_t prescaler;
uint32_t period;
uint32_t repetition_counter;
hal_lptim_mode_t mode;
} hal_lptim_config_t;
hal_lptim_ext_trig_config_t trigger;
hal_lptim_input1_src_t input1_src;
hal_lptim_input2_src_t input2_src;
hal_lptim_input1_config_t input1_config;
Note
|
HAL LPTIM output compare configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Pulse;
uint32_t OCPolarity;
} LPTIM_OC_ConfigTypeDef;
|
typedef struct
{
uint32_t pulse;
hal_lptim_oc_polarity_t polarity;
} hal_lptim_oc_config_t;
|
HAL LPTIM trigger configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Source;
uint32_t ActiveEdge;
uint32_t SampleTime;
} LPTIM_TriggerConfigTypeDef;
|
typedef struct
{
hal_lptim_ext_trig_src_t source;
hal_lptim_ext_trig_polarity_t polarity;
hal_lptim_filter_t filter;
} hal_lptim_ext_trig_config_t;
|
HAL LPTIM ultra low power clock configuration type definition ¶
Note
In HAL1,
the LPTIM_ULPClockConfigTypeDefstructure is used to configure the external clock source for the LPTIM peripheral, specifically throughthe input1. The user could select the clock source by setting theInput1Sourceparameter in the initialization structureIn HAL2, to configure the external clock source through the input1, we have the structure
hal_lptim_input1_config_twhich includes an enumeration for the input1 source, as well as separate fields for polarity and filter (sample time). Additionally, we have the following new APIs to configure the input1:A global configuration API
HAL_LPTIM_SetConfigInput1()function to set all parameters at onceUnitary configuration APIs:
HAL_LPTIM_SetInput1Filter(): To set the input1 filter.HAL_LPTIM_SetInput1Polarity(): To set the input1 polarity.HAL_LPTIM_SetInput1Source(): To set the input1 source.
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Polarity;
uint32_t SampleTime;
} LPTIM_ULPClockConfigTypeDef;
|
typedef struct
{
hal_lptim_input1_src_t src;
hal_lptim_input1_polarity_t polarity;
hal_lptim_filter_t filter;
} hal_lptim_input1_config_t;
|
HAL LPTIM callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
pLPTIM_CallbackTypeDef |
hal_lptim_cb_t |